<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
selection_test(
  [
    '<div contenteditable>',
      '<div>ab</div>',
      '<div contenteditable="false">',
        '<span>CD</span> <span contenteditable>|ef</span>',
      '</div>',
      '<div>gh</div>',
    '</div>',
  ],
  'selectAll',
  [
    '<div contenteditable>',
      '<div>^ab</div>',
      '<div contenteditable="false">',
        '<span>CD</span> <span contenteditable>ef</span>',
      '</div>',
      '<div>gh|</div>',
    '</div>',
  ],
  '1 SelectAll should select the contents of highest editable root.');

selection_test(
  [
    '<div contenteditable>',
      '<div id="extent">ab</div>',
      '<div contenteditable="false">',
        '<span>CD</span> <span contenteditable id="base">ef</span>',
      '</div>',
      '<div>gh</div>',
    '</div>',
  ],
  selection =>
    selection.setBaseAndExtent(selection.document.getElementById('base'), 1,
                               selection.document.getElementById('extent'), 0),
  [
    '<div contenteditable>',
      '<div id="extent">|ab</div>',
      '<div contenteditable="false">',
        '<span>CD</span> <span contenteditable id="base">ef^</span>',
      '</div>',
      '<div>gh</div>',
    '</div>',
  ],
  '2 Selection#setBaseAndExtent()');
</script>
